<table border="0" cellspacing="0" cellpadding="0">
    <?php for ($i = 1; $i <= 9; $i++) { ?>
        <tr>
            <?php for ($j = 1; $j <= 19; $j++) { ?>
                <td style="width:50px;height:50px;background-image: url('<?php echo base_url(); ?>resources/images/background/<?php echo $grid[$j][$i]->imageUrl; ?>');"></td>
            <?php } ?>
        </tr>
    <?php } ?>
</table>